package micro.controller.userMeun;

import com.alibaba.fastjson.JSONObject;

import micro.pojo.employee;
import micro.service.userMeun.userspace;
/*import net.sf.json.JSONObject;*/
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.util.HashMap;
import java.util.List;
@Controller
public class userMenu02 {
    @Autowired
    private userspace userspace;//前端分页，增加新用户
    @RequestMapping("/deletes")
    public String looks(HttpSession session, HttpServletRequest request) {
        System.out.println("進入");
        int id= Integer.parseInt(request.getParameter("id"));
        System.out.println(id);
        int employee= userspace.Dales(id);
        if (employee > 0) {
            System.out.println("删除成功");
            return "redirect:user/order";
        }else {
            System.out.println("删除失败");
            return "userMeun/userList";
        }
    }
    @RequestMapping("/See")
    private String Sees(HttpSession session,HttpServletRequest request){
        int id= Integer.parseInt(request.getParameter("id"));
        System.out.println(id);
        List<employee> cha= userspace.Sase(id);
        if (cha!=null) {
            System.out.println("进入详情查询");
            session.setAttribute("look",cha);
            return "redirect:user/order";
        }else {
            System.out.println("失败");
            return "redirect:user/order";
        }
    }
    @RequestMapping(value = "/ose",produces = "text/plain;charset=utf-8")
    @ResponseBody
    public Object jquery(HttpSession session, HttpServletRequest request, HttpServletResponse response , employee employee){
        HashMap<String,String > resultMap = new HashMap<String,String>();
        return null;
    }
  }
